document.addEventListener('DOMContentLoaded', () => {
    const newButton = document.getElementById('addButton');
    const modal = document.getElementById('modal');
    const closeButtons = document.querySelectorAll('.close');
    const dataForm = document.getElementById('dataForm');

    // 打开模态窗口
    newButton.onclick = function() {
        modal.style.display = 'block';
    }

    // 关闭模态窗口
    closeButtons.forEach(button => {
        button.onclick = function() {
            modal.style.display = 'none';
        }
    });


    // 点击窗口外的区域也关闭窗口
    window.onclick = function(event) {
        if (event.target === modal) {
            modal.style.display = 'none';
        }
    }
});